<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
<style>
      .box {
      width: 600px;
      padding: 50px 0;
      border: 1px solid #ccc;
    }

    .cube{
      width: 200px;
      height: 200px;
      margin: auto;
      position: relative;
      transition: 10s;
      transform-style: preserve-3d;
      perspective: 500px;
    }

    .cube>div {
      width: 100%;
      height: 100%;
      text-align: center;
      line-height: 200px;
      position: absolute;
      left: 0;
      top: 0;

    }

    .front {
      background-color: green;
      transform: translateZ(20px);
      /* 优先显示 */
      /* z-index: 9; */
    }

    .back {
      background-color: #f00;
      transform: translateZ(-20px);
    }

    .box:hover .cube {
      transform: rotateY(180deg);
    }

</style>

</head>
<body>
  <h3>3d转换之3d呈现</h3>
  <p>使子盒子置于真正的3d空间内</p>

  <div class="box">
    <div class="cube">
      <div class="front">前面</div>
      <div class="back">后面</div>
    </div>
</body>
</html>